/**
 * 
 * @param str 字符串
 * @description 校验字符串中是否含有4位连续递增，递减的数字或字母
 * @returns boolean
 */
export  function validateContinuousChar(str: string): boolean {
  for (let i = 0; i <= str.length - 4; i++) {
    let increasing = true;
    let decreasing = true;
    for (let j = 0; j < 3; j++) {
      if (str.charCodeAt(i + j) + 1 !== str.charCodeAt(i + j + 1)) {
        increasing = false;
      }
      if (str.charCodeAt(i + j) - 1 !== str.charCodeAt(i + j + 1)) {
        decreasing = false;
      }
    }
    if (increasing || decreasing) {
      return true;
    }
  }
  return false;
}
